USE master
GO

IF DB_ID('ChatForum') IS NOT NULL
 DROP DATABASE ChatForum
GO

CREATE DATABASE ChatForum
ON 
( NAME = ChatForum_dat,
   FILENAME = 'E:\ChatForumDB\ChatForum.mdf',
   SIZE = 100,
   MAXSIZE = 500,
   FILEGROWTH = 5 )
LOG ON
( NAME = 'ChatForum_log',
   FILENAME = 'E:\ChatForumDB\ChatForum.ldf',
   SIZE = 5MB,
   MAXSIZE = 25MB,
   FILEGROWTH = 5MB )
GO

USE [ChatForum]
GO

/****** Object:  Table [dbo].[User]    Script Date: 09/17/2012 17:40:13 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[User]') AND type in (N'U'))
DROP TABLE [dbo].[User]
GO

CREATE TABLE [dbo].[User](
	[firstName] [varchar](50) NOT NULL,
	[middleName] [varchar](50) NOT NULL,
	[lastName] [varchar](50) NOT NULL,
	[id] [uniqueidentifier] NOT NULL,
	[sex] [varchar](50) NOT NULL,
	[dateOfBirth] [date] NOT NULL,
	[country] [varchar](50) NOT NULL,
	[emailId] [varchar](50) NOT NULL,
	[alternateEmailId] [varchar](50) NOT NULL,
	[userId] [varchar](50) NOT NULL,
	[password] [varchar](50) NOT NULL,
	[role] [int] NOT NULL,
	[status] [bit] NOT NULL,
	[isOnline] [bit] NOT NULL,
	[lastLogInTime] [datetime] NOT NULL,
	[mobileNo] [bigint] NOT NULL,
	[createdDate] [datetime] NOT NULL,
	[createdBy] [varchar](50) NOT NULL,
	[modifiedDate] [datetime] NOT NULL,
	[modifiedBy] [varchar](50) NOT NULL
) ON [PRIMARY]
GO

/****** Object:  Table [dbo].[Category]    Script Date: 03/23/2013 13:49:13 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Category]') AND type in (N'U'))
DROP TABLE [dbo].[Category]
GO

CREATE TABLE [dbo].[Category](
	[name] [varchar](50) NOT NULL,
	[description] [varchar](100) NULL,
	[ageRequirement] [int] NOT NULL,
	[id] [uniqueidentifier] NOT NULL,
	[createdDate] [datetime] NOT NULL,
	[createdBy] [varchar](50) NOT NULL,
	[modifiedDate] [datetime] NOT NULL,
	[modifiedBy] [varchar](50) NOT NULL
) ON [PRIMARY]
GO

/****** Object:  Table [dbo].[Post]    Script Date: 03/23/2013 13:49:13 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Post]') AND type in (N'U'))
DROP TABLE [dbo].[Post]
GO

CREATE TABLE [dbo].[Post](
	[title] [varchar](100) NOT NULL,
	[description] [varchar](200) NULL,
	[parentPost] [uniqueidentifier] NOT NULL,
	[id] [uniqueidentifier] NOT NULL,
	[parentCategory] [uniqueidentifier] NOT NULL,
	[rating] [int] NOT NULL,
	[createdDate] [datetime] NOT NULL,
	[createdBy] [varchar](50) NOT NULL,
	[modifiedDate] [datetime] NOT NULL,
	[modifiedBy] [varchar](50) NOT NULL
) ON [PRIMARY]
GO